/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "ALUMNO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Alumno.findAll", query = "SELECT a FROM Alumno a"),
    @NamedQuery(name = "Alumno.findByAluCod", query = "SELECT a FROM Alumno a WHERE a.aluCod = :aluCod"),
    @NamedQuery(name = "Alumno.findByAluMat", query = "SELECT a FROM Alumno a WHERE a.aluMat = :aluMat"),
    @NamedQuery(name = "Alumno.findByAluNom", query = "SELECT a FROM Alumno a WHERE a.aluNom = :aluNom"),
    @NamedQuery(name = "Alumno.findByAluDir", query = "SELECT a FROM Alumno a WHERE a.aluDir = :aluDir"),
    @NamedQuery(name = "Alumno.findByAluTel1", query = "SELECT a FROM Alumno a WHERE a.aluTel1 = :aluTel1"),
    @NamedQuery(name = "Alumno.findByAluTel2", query = "SELECT a FROM Alumno a WHERE a.aluTel2 = :aluTel2"),
    @NamedQuery(name = "Alumno.findByAluMail", query = "SELECT a FROM Alumno a WHERE a.aluMail = :aluMail"),
    @NamedQuery(name = "Alumno.findByAluSexo", query = "SELECT a FROM Alumno a WHERE a.aluSexo = :aluSexo"),
    @NamedQuery(name = "Alumno.findByAluFnac", query = "SELECT a FROM Alumno a WHERE a.aluFnac = :aluFnac"),
    @NamedQuery(name = "Alumno.findByAluEst", query = "SELECT a FROM Alumno a WHERE a.aluEst = :aluEst"),
    @NamedQuery(name = "Alumno.findByDocNum", query = "SELECT a FROM Alumno a WHERE a.docNum = :docNum"),
    @NamedQuery(name = "Alumno.findByAluPubCod", query = "SELECT a FROM Alumno a WHERE a.aluPubCod = :aluPubCod"),
    @NamedQuery(name = "Alumno.findByAluPubOtro", query = "SELECT a FROM Alumno a WHERE a.aluPubOtro = :aluPubOtro")})
public class Alumno implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ALU_COD")
    private Integer aluCod;
    @Basic(optional = false)
    @Column(name = "ALU_MAT")
    private String aluMat;
    @Basic(optional = false)
    @Column(name = "ALU_NOM")
    private String aluNom;
    @Column(name = "ALU_DIR")
    private String aluDir;
    @Column(name = "ALU_TEL1")
    private String aluTel1;
    @Column(name = "ALU_TEL2")
    private String aluTel2;
    @Column(name = "ALU_MAIL")
    private String aluMail;
    @Column(name = "ALU_SEXO")
    private Character aluSexo;
    @Column(name = "ALU_FNAC")
    @Temporal(TemporalType.DATE)
    private Date aluFnac;
    @Column(name = "ALU_EST")
    private Short aluEst;
    @Column(name = "DOC_NUM")
    private String docNum;
    @Column(name = "ALU_PUB_COD")
    private Short aluPubCod;
    @Column(name = "ALU_PUB_OTRO")
    private String aluPubOtro;
    @OneToMany(mappedBy = "aluCod", fetch = FetchType.LAZY)
    private List<Provision> provisionList;
    @OneToMany(mappedBy = "aluCod", fetch = FetchType.LAZY)
    private List<IngresoEgreso> ingresoEgresoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "alumno", fetch = FetchType.LAZY)
    private List<Inscripcion> inscripcionList;
    @OneToMany(mappedBy = "aluCod", fetch = FetchType.LAZY)
    private List<ProgramaGrupo> programaGrupoList;
    @JoinColumn(name = "SUBD_COD", referencedColumnName = "SUBD_COD")
    @ManyToOne(fetch = FetchType.LAZY)
    private SubDependencia subdCod;
    @JoinColumn(name = "DOC_COD", referencedColumnName = "DOC_COD")
    @ManyToOne(fetch = FetchType.LAZY)
    private DocumentoIdentidad docCod;
    @JoinColumn(name = "DIST_COD", referencedColumnName = "DIST_COD")
    @ManyToOne(fetch = FetchType.LAZY)
    private Distrito distCod;
    @JoinColumn(name = "ALUT_COD", referencedColumnName = "ALUT_COD")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private AlumnoTipo alutCod;

    public Alumno() {
    }

    public Alumno(Integer aluCod) {
        this.aluCod = aluCod;
    }

    public Alumno(Integer aluCod, String aluMat, String aluNom) {
        this.aluCod = aluCod;
        this.aluMat = aluMat;
        this.aluNom = aluNom;
    }

    public Integer getAluCod() {
        return aluCod;
    }

    public void setAluCod(Integer aluCod) {
        this.aluCod = aluCod;
    }

    public String getAluMat() {
        return aluMat;
    }

    public void setAluMat(String aluMat) {
        this.aluMat = aluMat;
    }

    public String getAluNom() {
        return aluNom;
    }

    public void setAluNom(String aluNom) {
        this.aluNom = aluNom;
    }

    public String getAluDir() {
        return aluDir;
    }

    public void setAluDir(String aluDir) {
        this.aluDir = aluDir;
    }

    public String getAluTel1() {
        return aluTel1;
    }

    public void setAluTel1(String aluTel1) {
        this.aluTel1 = aluTel1;
    }

    public String getAluTel2() {
        return aluTel2;
    }

    public void setAluTel2(String aluTel2) {
        this.aluTel2 = aluTel2;
    }

    public String getAluMail() {
        return aluMail;
    }

    public void setAluMail(String aluMail) {
        this.aluMail = aluMail;
    }

    public Character getAluSexo() {
        return aluSexo;
    }

    public void setAluSexo(Character aluSexo) {
        this.aluSexo = aluSexo;
    }

    public Date getAluFnac() {
        return aluFnac;
    }

    public void setAluFnac(Date aluFnac) {
        this.aluFnac = aluFnac;
    }

    public Short getAluEst() {
        return aluEst;
    }

    public void setAluEst(Short aluEst) {
        this.aluEst = aluEst;
    }

    public String getDocNum() {
        return docNum;
    }

    public void setDocNum(String docNum) {
        this.docNum = docNum;
    }

    public Short getAluPubCod() {
        return aluPubCod;
    }

    public void setAluPubCod(Short aluPubCod) {
        this.aluPubCod = aluPubCod;
    }

    public String getAluPubOtro() {
        return aluPubOtro;
    }

    public void setAluPubOtro(String aluPubOtro) {
        this.aluPubOtro = aluPubOtro;
    }

    @XmlTransient
    public List<Provision> getProvisionList() {
        return provisionList;
    }

    public void setProvisionList(List<Provision> provisionList) {
        this.provisionList = provisionList;
    }

    @XmlTransient
    public List<IngresoEgreso> getIngresoEgresoList() {
        return ingresoEgresoList;
    }

    public void setIngresoEgresoList(List<IngresoEgreso> ingresoEgresoList) {
        this.ingresoEgresoList = ingresoEgresoList;
    }

    @XmlTransient
    public List<Inscripcion> getInscripcionList() {
        return inscripcionList;
    }

    public void setInscripcionList(List<Inscripcion> inscripcionList) {
        this.inscripcionList = inscripcionList;
    }

    @XmlTransient
    public List<ProgramaGrupo> getProgramaGrupoList() {
        return programaGrupoList;
    }

    public void setProgramaGrupoList(List<ProgramaGrupo> programaGrupoList) {
        this.programaGrupoList = programaGrupoList;
    }

    public SubDependencia getSubdCod() {
        return subdCod;
    }

    public void setSubdCod(SubDependencia subdCod) {
        this.subdCod = subdCod;
    }

    public DocumentoIdentidad getDocCod() {
        return docCod;
    }

    public void setDocCod(DocumentoIdentidad docCod) {
        this.docCod = docCod;
    }

    public Distrito getDistCod() {
        return distCod;
    }

    public void setDistCod(Distrito distCod) {
        this.distCod = distCod;
    }

    public AlumnoTipo getAlutCod() {
        return alutCod;
    }

    public void setAlutCod(AlumnoTipo alutCod) {
        this.alutCod = alutCod;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (aluCod != null ? aluCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Alumno)) {
            return false;
        }
        Alumno other = (Alumno) object;
        if ((this.aluCod == null && other.aluCod != null) || (this.aluCod != null && !this.aluCod.equals(other.aluCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
//        return "pe.edu.unmsm.cinfo.siga.datos.Alumno[ aluCod=" + aluCod + " ]";
        return getAluNom();
    }
    
}
